layui.use(['element','layer'],function () {
    var $ = layui.$;
    var layer = layui.layer;
   $(".pay-btn").on('click',function(){
       var channel = $(this).data("channel");
       if(channel == 1){
           location.href = "/receipt/payonline2?channel=1&receiptId=" + $("#receiptId").val()+"&orgId=" + $("#orgId").val();
       }else if(channel == 2){
           location.href = "/receipt/payonline2?channel=2&receiptId=" + $("#receiptId").val()+"&orgId=" + $("#orgId").val();
       }else if(channel == 3) {
           $.ajax({
               url: '/receipt/wappay',
               data: {receiptId: $("#receiptId").val(), channel: channel},
               type: 'POST',
               dataType: 'json',
               success: function (res) {
                   if (res.code == 200) {
                       location.href = res.data.code_url;
                   } else {
                       layer.msg("服务器繁忙,请联系管理员！");
                   }
               },
               error: function () {
                   layer.msg("服务器繁忙,请联系管理员！");
               }
           });
       }
   });
});